package com.oliver.picturebackendspaceservice.controller.inner;

import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.oliver.picturebackendcommon.model.vo.SpaceVO;
import com.oliver.picturebackendmodel.model.entity.Space;
import com.oliver.picturebackendopenfign.feignClient.SpaceFeignClient;
import com.oliver.picturebackendspaceservice.service.SpaceService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * @ClassName SpaceInnerController
 * @Description TODO
 * @Author snow
 * @Date 2025/1/26 21:46
 **/

@RestController
@RequestMapping("/inner")
@Api(tags = "空间模块-openFeign")
public class SpaceInnerController implements SpaceFeignClient {

    @Resource
    private SpaceService spaceService;

    /**
     * VO类转换
     * @param space
     * @return
     */
    @PostMapping("/get/SpaceVo")
    @Override
    public SpaceVO getSpaceVO(@RequestBody Space space){
        return spaceService.getSpaceVO(space);
    }

    @GetMapping("/get/id")
    @Override
    public Space getById(@RequestParam("spaceId") Long spaceId){
        return spaceService.getById(spaceId);
    }

    @GetMapping("/get/ids")
    @Override
    public List<Space> listByIds(@RequestParam("spaceIdSet") Collection<Long> spaceIdSet){
        return spaceService.listByIds(spaceIdSet);
    }

    @GetMapping("/getLambdaUpdate")
    @Override
    public LambdaUpdateChainWrapper<Space> lambdaUpdate(){
        return spaceService.lambdaUpdate();
    }
}
